<?php

/**
 * zc_return_visits filter form base class.
 *
 * @package    zc
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class Basezc_return_visitsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'rv_time'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'rv_content'   => new sfWidgetFormFilterInput(),
      'rv_next_time' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'rv_question'  => new sfWidgetFormFilterInput(),
      'rv_info'      => new sfWidgetFormFilterInput(),
      'info_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('zc_user_info'), 'add_empty' => true)),
      'si_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('zc_susscu_intention'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'rv_time'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'rv_content'   => new sfValidatorPass(array('required' => false)),
      'rv_next_time' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'rv_question'  => new sfValidatorPass(array('required' => false)),
      'rv_info'      => new sfValidatorPass(array('required' => false)),
      'info_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('zc_user_info'), 'column' => 'info_id')),
      'si_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('zc_susscu_intention'), 'column' => 'si_id')),
    ));

    $this->widgetSchema->setNameFormat('zc_return_visits_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'zc_return_visits';
  }

  public function getFields()
  {
    return array(
      'rv_id'        => 'Number',
      'rv_time'      => 'Date',
      'rv_content'   => 'Text',
      'rv_next_time' => 'Date',
      'rv_question'  => 'Text',
      'rv_info'      => 'Text',
      'info_id'      => 'ForeignKey',
      'si_id'        => 'ForeignKey',
    );
  }
}
